package oj;

public class Main1 {
    public static void rotate(int[] nums, int k) {
        int n = nums.length;
        int[] array = new int[n];
        for(int i = 0;i < n;++i){
            array[(i + k) % n] = nums[i];
        }
        System.arraycopy(array,0,nums,0,n);
    }
    public static void main(String[] args) {
        int[] nums = {1,2,3,4,5,6,7};
        rotate(nums,2);
        System.out.println(nums);
    }
}
